package o;

import com.google.android.exoplayer2.metadata.Metadata;
import com.google.android.exoplayer2.metadata.Metadata.Entry;
import com.google.android.exoplayer2.metadata.id3.CommentFrame;
import com.google.android.exoplayer2.metadata.id3.InternalFrame;
import java.util.regex.Matcher;
import java.util.regex.Pattern;

public final class aec {
    private static final Pattern ˎ = Pattern.compile("^ [0-9a-fA-F]{8} ([0-9a-fA-F]{8}) ([0-9a-fA-F]{8})");
    public int ˏ = -1;
    public int ॱ = -1;

    public boolean ॱ(int i) {
        int i2 = i >> 12;
        int i3 = i & 4095;
        if (i2 <= 0 && i3 <= 0) {
            return false;
        }
        this.ˏ = i2;
        this.ॱ = i3;
        return true;
    }

    public boolean ॱ(Metadata metadata) {
        for (int i = 0; i < metadata.ˋ(); i++) {
            Entry ˋ = metadata.ˋ(i);
            if (ˋ instanceof CommentFrame) {
                CommentFrame commentFrame = (CommentFrame) ˋ;
                if ("iTunSMPB".equals(commentFrame.ˎ) && ॱ(commentFrame.ˋ)) {
                    return true;
                }
            } else if (ˋ instanceof InternalFrame) {
                InternalFrame internalFrame = (InternalFrame) ˋ;
                if ("com.apple.iTunes".equals(internalFrame.ॱ) && "iTunSMPB".equals(internalFrame.ˊ) && ॱ(internalFrame.ˋ)) {
                    return true;
                }
            } else {
                continue;
            }
        }
        return false;
    }

    private boolean ॱ(String str) {
        Matcher matcher = ˎ.matcher(str);
        if (matcher.find()) {
            try {
                int parseInt = Integer.parseInt(matcher.group(1), 16);
                int parseInt2 = Integer.parseInt(matcher.group(2), 16);
                if (parseInt > 0 || parseInt2 > 0) {
                    this.ˏ = parseInt;
                    this.ॱ = parseInt2;
                    return true;
                }
            } catch (NumberFormatException e) {
            }
        }
        return false;
    }

    public boolean ˎ() {
        return (this.ˏ == -1 || this.ॱ == -1) ? false : true;
    }
}
